package com.learn.algorithm;

/**
 * 开根号
 */
public class MatchSqrt {
    public static double sqrt(int v, double t) {
        if (t < 0) {
            t *= -1;
        }

        double u = v / (t * t);
        System.out.println("u:"+u+"/("+t+"*"+t+")");
        int s = 0;
        while (s * s <= u) {
            System.out.println(">u:"+u+" s:"+s);
            s++;
        }
        System.out.println("("+s+"-1)*"+t);
        return (s - 1) * t;
    }
}
